function setCookie(cookieName, cookieValue, expiresTime) {
    const expirationDate = new Date();
    expirationDate.setSeconds(expirationDate.getSeconds() + expiresTime);
    document.cookie = `${cookieName}=${cookieValue}; expires=${expirationDate.toUTCString()}`;
}

function getCookie(name) {
    // 读取cookie
    const cookieString = document.cookie;
    // 切割cookie项
    const cookies = cookieString.split('; ');
    // 遍历cookie
    for (const cookie of cookies) {
        const [cookieName, cookieValue] = cookie.split('=')
        // 拿到所需cookie值
        if (cookieName === name) {
            return cookieValue
        }
    }
    return null;
}


export {setCookie, getCookie}